<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>
    <input id="txt" type="text" value="请输入内容...">
    <script>
        var t = document.getElementById("txt");
        //文本框获得焦点
        t.onfocus = function () {
            if (t.value === "请输入内容...") {
                t.value = "";
            }
        };
        //失去焦点
        t.onblur = function() {
            if(t.value === "") {
                t.value = "请输入内容...";
            }
        };
    </script>

    <input type="text" placeholder="请输入内容...">
</body>

</html>